import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: HomeView,
    children: [
      {
        path: '/sys-admin/product/album',
        name: '相册管理',
        component: () => import('../views/sys-admin/product/AlbumListView.vue')
      },
      {
        path: '/sys-admin/product/album/add-new',
        name: '新增相册',
        component: () => import('../views/sys-admin/product/AlbumAddNewView.vue')
      },
      {
        path: '/sys-admin/product/album/picture-list',
        name: '图片管理',
        component: () => import('../views/sys-admin/product/AlbumPictureListView.vue')
      },
      {
        path: '/sys-admin/product/category',
        name: '类别管理',
        component: () => import('../views/sys-admin/product/CategoryListView.vue')
      },
      {
        path: '/sys-admin/product/category/add-new',
        name: '新增类别',
        component: () => import('../views/sys-admin/product/CategoryAddNewView.vue')
      },
      // ======================== 属性模板、属性 ========================
      {
        path: '/sys-admin/product/attribute-template',
        name: '属性模板管理',
        component: () => import('../views/sys-admin/product/AttributeTemplateListView.vue')
      },
      {
        path: '/sys-admin/product/attribute/add-new',
        name: '新增属性',
        component: () => import('../views/sys-admin/product/AttributeAddNewView.vue')
      },{
        path: '/sys-admin/product/attribute',
        name: '属性管理',
        component: () => import('../views/sys-admin/product/AttributeListView.vue')
      },
      {
        path: '/sys-admin/product/attribute-template/add-new',
        name: '新增属性模板',
        component: () => import('../views/sys-admin/product/AttributeTemplateAddNewView.vue')
      },
      // ======================== 品牌 ========================
      {
        path: '/sys-admin/product/brand',
        name: '品牌管理',
        component: () => import('../views/sys-admin/product/BrandListView')
      },
      {
        path: '/sys-admin/product/brand/add-new',
        name: '新增品牌',
        component: () => import('../views/sys-admin/product/BrandAddNewView')
      },
      // ======================== SPU ========================
      {
        path: '/sys-admin/product/spu-management',
        name: 'SPU台账',
        component: () => import('../views/sys-admin/product/SpuManagement.vue')
      },
      {
        path: '/sys-admin/product/spu-management/sku',
        name: 'SKU管理',
        component: () => import('../views/sys-admin/product/SkuListView.vue')
      },
      {
        path: '/sys-admin/product/spu/add-new-1',
        name: '第1步：选择商品类别',
        component: () => import('../views/sys-admin/product/SpuAddNewView1.vue')
      },
      {
        path: '/sys-admin/product/spu/add-new-2',
        name: '第2步：填写基本信息',
        component: () => import('../views/sys-admin/product/SpuAddNewView2.vue')
      },
      {
        path: '/sys-admin/product/spu/add-new-3',
        name: '第3步：选择商品相册',
        component: () => import('../views/sys-admin/product/SpuAddNewView3.vue')
      },
      {
        path: '/sys-admin/product/spu/add-new-4',
        name: '第4步：填写商品详情',
        component: () => import('../views/sys-admin/product/SpuAddNewView4.vue')
      },
      // ======================== 权限管理 ========================
      {
        path: '/sys-admin/permission/admin',
        name: '管理员管理',
        component: () => import('../views/sys-admin/permission/AdminListView')
      },
      {
        path: '/sys-admin/permission/admin/add-new',
        name: '新增管理员',
        component: () => import('../views/sys-admin/permission/AdminAddNewView')
      }

    ]
  },
  {
    path: '/about',
    component: () => import( '../views/AboutView.vue')
  },
  {
    path: '/login',
    component: () => import( '../views/LoginView.vue')
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
